<?php
/**
 * Created by PhpStorm.
 * User: krystal
 * Date: 2019/4/9
 * Time: 11:57
 */

namespace app\common\model;


class ZhunleFortune extends Base
{
    protected $table = 'wechat_backup_07_18_14_43_00.zhunle_fortune';

    public function saveFortune($map = [], $id = 0)
    {
        if ($id === 0) {
            try {

                $this->save($map);
            } catch (\Exception $e) {
                $this->error = '运势记录入库失败';
                return false;
            }
        } else {
            try {

                $this->update($map, ['id' => $id]);
            } catch (\Exception $e) {
                $this->error = '运势记录更新失败';
                return false;
            }
        }

        return true;

    }

}